<template>
	<view>
		<uni-list>
			<uni-list-item v-for="(item,index) in addressList" :key="index" 
			@click="addressSelection(index)" showArrow clickable>
				<view slot="body" class="slot-box">
					<text :class="index === activeIndex?'text-main font-md':'font-md'">{{item.area_name}}</text>
				</view>
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import areaPro from '@/common/area-pro.js'
	export default {
		data() {
			return {
				addressList: areaPro.list,
				activeIndex: 0,
			}
		},
		onLoad() {
		},
		methods: {
			addressSelection(index) {
				this.activeIndex = index
				let areaCode = this.addressList[index]['area_code']
				console.log(areaCode);
				uni.navigateTo({
					url: '../address-second/address-second?areaCode='+areaCode
				});
			}
		},
		computed: {

		}
	}
</script>

<style>
	.slot-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
	}
</style>
